#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author:zbsilent


import os, sys, time

# 文件句柄
_file = open("yesterday", "r", encoding="utf-8")
print(_file.readline())

_file5 = open("yesterday3", "wb")

_str_ = "test"

_strs = _str_.encode("utf-8")
print(type(_strs))
_file5.write(_strs)
# print(_file.readlines())
# _file.write("哦爱2234234234234你\n")
# for xx in _file.readlines():
#     print(xx)
# sub = _file.readlines()
# print(type(sub))
# sub.insert(0,88)
# for dd in sub:
#     _file.write(str(dd))

'''
rb 二进制格式
用于网络传输模式 
视频什么的 
'''
# 所有商品信息列表行读取
_data = _file.readlines()
"""
file common method；

    print(_file.readline())
    print(_file.tell())
    print(_file.seek(0))
    print(_file.readline())
    print(_file.readline())
    print(_file.readline())
    print(_file.encoding)
    print(_file.fileno()) # 返回一个编号 内存地址编号
    print(_file.name)
    print(_file.readable()) # 判断文件是不是可以读
"""

_file2 = open("yesterday2", "w", encoding="utf-8")

_file2.write("aaini")
_file2.write("\n")
_file2.write("aaini2")

# Forced to refresh 强制刷新 本身等待的是缓存满足后才会有
_file2.flush()

# 打印进度调


'''
for xx in _file3.readlines():
    # print(xx)
    sys.stdout.write("#") # 进度调输出 不换行
    sys.stdout.flush()
    # time.sleep(3) # 睡眠3秒后打印
'''
